package com.hf.action;

import java.sql.Timestamp;
import java.util.*;

import org.hibernate.Query;

import tool.TimeTool;
import tool.UploadImg;

import com.base.bean.*;
import com.base.dao.*;
import com.base.service.*;
import com.base.service.client.ChangeOwnerFormBean;
import com.base.service.client.ClientOwnerService;

import com.base.domain.*;
import com.hf.bean.ActivityCount;

/**
 * 行动管理 －－－新增了如果是非自己的客户
 * 
 * @author Administrator
 * 
 */

public class ChangeOwnerAction extends BaseAction {
//	private String openId;
	private Integer cid;
	private Integer state;

	// 以下是只读项
	private boolean locked;
//	private String tip;
	private boolean result;

	private ChangeOwnerFormBean formbean;

	private ClientOwnerService cos;

	public ChangeOwnerAction() {
		this.cos = ClientOwnerService.getInstance();
	}

	/**
	 * 
	 */
	@Override
	public String execute() {
		// 测试赋值
		// this.openId="olWUvt186RJV4_obaeMV5SGT4e2g";
		// this.cid=117;

		this.tip = "";
		this.openId = (this.openId == null ? "" : this.openId);
		this.cid = (this.cid == null ? 0 : this.cid);
		this.state = (this.state == null ? 0 : this.state);

		ChangeOwnerFormBean bean = new ChangeOwnerFormBean();
		bean.setCid(this.cid);
		bean.setOpenId(this.openId);
		bean.setState(this.state);

		this.formbean = cos.changeOwner(bean, 100);
		this.tip=this.formbean.getTip();
		
		if(this.formbean.isResult()==false){
			return ERROR;
		}

		return SUCCESS;
	}

	public static void main(String[] args) {
		ChangeOwnerAction a = new ChangeOwnerAction();
		a.execute();
		System.out.println(a.getTip());

	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public Integer getCid() {
		return cid;
	}

	public void setCid(Integer cid) {
		this.cid = cid;
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public boolean isLocked() {
		return locked;
	}

	public void setLocked(boolean locked) {
		this.locked = locked;
	}

	public String getTip() {
		return tip;
	}

	public void setTip(String tip) {
		this.tip = tip;
	}

	public boolean isResult() {
		return result;
	}

	public void setResult(boolean result) {
		this.result = result;
	}

	public ChangeOwnerFormBean getFormbean() {
		return formbean;
	}

	public void setFormbean(ChangeOwnerFormBean formbean) {
		this.formbean = formbean;
	}

}
